package com.ruoyi.web.controller.shop;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.ruoyi.common.utils.file.MimeTypeUtils;
import com.ruoyi.framework.web.service.TokenService;
import com.ruoyi.system.service.ISysDeptService;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 店铺信息 业务处理
 * 
 * @author ruoyi
 */
@RestController
@RequestMapping("/shop/info")
public class ShopInfoController extends BaseController
{
    @Autowired
    private ISysUserService userService;

    @Autowired
    private TokenService tokenService;

    @Autowired
    private ISysDeptService deptService;

    /**
     * 获取店铺信息
     */
    @PreAuthorize("@ss.hasPermi('shop:info:index')")
    @GetMapping("/index")
    public AjaxResult getInfo()
    {
        AjaxResult ajax = AjaxResult.success();

        LoginUser loginUser = getLoginUser();
        SysUser user = loginUser.getUser();

        if (StringUtils.isNotNull(user.getUserId()))
        {
            SysDept dept = deptService.selectDeptById(user.getDeptId());
            ajax.put(AjaxResult.DATA_TAG, dept);
        }
        return ajax;
    }

}
